<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />

<META HTTP-EQUIV="pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, must-revalidate"> 
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT"> 
<META HTTP-EQUIV="expires" CONTENT="0"> 

<title>欢迎来到正耐英语</title>

<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />

<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="../../assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="../../assets/css/font-awesome.min.css" />

<!-- text fonts -->
<link rel="stylesheet" href="../../assets/css/ace-fonts.css" />

<!-- ace styles -->
<link rel="stylesheet" href="../../assets/css/ace.min.css"
	id="main-ace-style" />

<!--[if lte IE 9]>
			<link rel="stylesheet" href="../../assets/css/ace-part2.min.css" />
		<![endif]-->
<link rel="stylesheet" href="../../assets/css/ace-skins.min.css" />
<link rel="stylesheet" href="../../assets/css/ace-rtl.min.css" />

<!--[if lte IE 9]>
		  <link rel="stylesheet" href="../../assets/css/ace-ie.min.css" />
		<![endif]-->

<!-- ace settings handler -->
<script src="../../assets/js/ace-extra.min.js"></script>

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->

<!--[if lte IE 8]>
		<script src="../../assets/js/html5shiv.js"></script>
		<script src="../../assets/js/respond.min.js"></script>
		<![endif]-->
</head>

<body class="no-skin">
	<!-- #section:basics/navbar.layout -->
	<div id="navbar" class="navbar navbar-default">
		<script type="text/javascript">
			try {
				ace.settings.check('navbar', 'fixed')
			} catch (e) {
			}
		</script>

		<div class="navbar-container" id="navbar-container">
			<!-- #section:basics/sidebar.mobile.toggle -->
			<button type="button" class="navbar-toggle menu-toggler pull-left"
				id="menu-toggler">
				<span class="sr-only">Toggle sidebar</span> <span class="icon-bar"></span>

				<span class="icon-bar"></span> <span class="icon-bar"></span>
			</button>

			<!-- /section:basics/sidebar.mobile.toggle -->
			<div class="navbar-header pull-left">
				<!-- #section:basics/navbar.layout.brand -->
				<a href="#" class="navbar-brand"> <small> <i
						class="fa fa-leaf"></i> 正耐英语
				</small>
				</a>

				<!-- /section:basics/navbar.layout.brand -->

				<!-- #section:basics/navbar.toggle -->

				<!-- /section:basics/navbar.toggle -->
			</div>

			<!-- #section:basics/navbar.dropdown -->
			<div class="navbar-buttons navbar-header pull-right"
				role="navigation">
				<ul class="nav ace-nav">
					<!-- #section:basics/navbar.user_menu -->
					<li class="light-blue"><a data-toggle="dropdown" href="#"
						class="dropdown-toggle"> <img id="headImg"
							class="nav-user-photo" src="../../assets/avatars/profile-pic.jpg"
							alt="" /> <span class="user-info"> <small>欢迎,</small> <span
								id="usernameSpan"></span>
						</span> <i class="ace-icon fa fa-caret-down"></i>
					</a>

						<ul
							class="user-menu dropdown-menu-right dropdown-menu dropdown-yellow dropdown-caret dropdown-close">
							<!-- 								<li> -->
							<!-- 									<a href="#"> -->
							<!-- 										<i class="ace-icon fa fa-cog"></i> -->
							<!-- 										Settings -->
							<!-- 									</a> -->
							<!-- 								</li> -->

							<!-- 								<li> -->
							<!-- 									<a href="../profile.html"> -->
							<!-- 										<i class="ace-icon fa fa-user"></i> -->
							<!-- 										Profile -->
							<!-- 									</a> -->
							<!-- 								</li> -->

							<li class="divider"></li>

							<li><a href="../../logout"> <i
									class="ace-icon fa fa-power-off"></i> Logout
							</a></li>
						</ul></li>

					<!-- /section:basics/navbar.user_menu -->
				</ul>
			</div>

			<!-- /section:basics/navbar.dropdown -->
		</div>
		<!-- /.navbar-container -->
	</div>

	<!-- /section:basics/navbar.layout -->
	<div class="main-container" id="main-container">
		<script type="text/javascript">
			try {
				ace.settings.check('main-container', 'fixed')
			} catch (e) {
			}
		</script>

		<!-- #section:basics/sidebar -->
		<div id="sidebar" class="sidebar                  responsive">
			<script type="text/javascript">
				try {
					ace.settings.check('sidebar', 'fixed')
				} catch (e) {
				}
			</script>


			<ul class="nav nav-list">
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/quizs"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							测验管理 </span>
				</a> <b class="arrow"></b></li>
				<!-- 					<li class=""> -->
				<!-- 						<a data-url="page/index" href="ajax.html#page/index"> -->
				<!-- 							<i class="menu-icon fa fa-tachometer"></i> -->
				<!-- 							<span class="menu-text"> Dashboard </span> -->
				<!-- 						</a> -->

				<!-- 						<b class="arrow"></b> -->
				<!-- 					</li> -->

				<!-- 					<li class=""> -->
				<!-- 						<a href="#" class="dropdown-toggle"> -->
				<!-- 							<i class="menu-icon fa fa-list"></i> -->
				<!-- 							<span class="menu-text"> Articles </span> -->

				<!-- 							<b class="arrow fa fa-angle-down"></b> -->
				<!-- 						</a> -->

				<!-- 						<b class="arrow"></b> -->

				<!-- 						<ul class="submenu"> -->
				<!-- 							<li class=""> -->
				<!-- 								<a data-url="page/tables" href="ajax.html#page/newArticle"> -->
				<!-- 									<i class="menu-icon fa fa-caret-right"></i> -->
				<!-- 									Create Article -->
				<!-- 								</a> -->

				<!-- 								<b class="arrow"></b> -->
				<!-- 							</li> -->

				<!-- 							<li class=""> -->
				<!-- 								<a data-url="page/jqgrid" href="ajax.html#page/articles"> -->
				<!-- 									<i class="menu-icon fa fa-caret-right"></i> -->
				<!-- 									Article List -->
				<!-- 								</a> -->

				<!-- 								<b class="arrow"></b> -->
				<!-- 							</li> -->
				<!-- 						</ul> -->
				<!-- 					</li> -->
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/articles2"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							素材管理 </span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/mywords"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							我的单词 </span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/mysens"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							我的句子</span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/articles2Others"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							他山之材</span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/otherswords"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							他山之词 </span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/reminder"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							提醒设置 </span>
				</a> <b class="arrow"></b></li>
				<li class=""><a data-url="page/widgets"
					href="ajax.html#page/audios"> <i
						class="menu-icon fa fa-list-alt"></i> <span class="menu-text">
							Audio </span>
				</a> <b class="arrow"></b></li>
<!-- 				<li class=""><a data-url="page/widgets" -->
<!-- 					href="ajax.html#page/sentences2"> <i -->
<!-- 						class="menu-icon fa fa-list-alt"></i> <span class="menu-text"> -->
<!-- 							Sentences </span> -->
<!-- 				</a> <b class="arrow"></b></li> -->
<!-- 				<li class=""><a data-url="page/widgets" -->
<!-- 					href="ajax.html#page/words2"> <i -->
<!-- 						class="menu-icon fa fa-list-alt"></i> <span class="menu-text"> -->
<!-- 							Words </span> -->
<!-- 				</a> <b class="arrow"></b></li> -->


			</ul>
			<!-- /.nav-list -->

			<!-- #section:basics/sidebar.layout.minimize -->
			<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
				<i class="ace-icon fa fa-angle-double-left"
					data-icon1="ace-icon fa fa-angle-double-left"
					data-icon2="ace-icon fa fa-angle-double-right"></i>
			</div>

			<!-- /section:basics/sidebar.layout.minimize -->
			<script type="text/javascript">
				try {
					ace.settings.check('sidebar', 'collapsed')
				} catch (e) {
				}
			</script>
		</div>

		<!-- /section:basics/sidebar -->
		<div class="main-content">
			<!-- #section:basics/content.breadcrumbs -->
			<div class="breadcrumbs" id="breadcrumbs">
				<script type="text/javascript">
					try {
						ace.settings.check('breadcrumbs', 'fixed')
					} catch (e) {
					}
				</script>

				<ul class="breadcrumb">
					<li><i class="ace-icon fa fa-home home-icon"></i> <a href="#">Home</a>
					</li>
				</ul>
				<!-- /.breadcrumb -->


			</div>

			<!-- /section:basics/content.breadcrumbs -->
			<div class="page-content">
				<!-- #section:settings.box -->
				<div class="ace-settings-container" id="ace-settings-container">
					<div class="btn btn-app btn-xs btn-warning ace-settings-btn"
						id="ace-settings-btn">
						<i class="ace-icon fa fa-cog bigger-150"></i>
					</div>

					<div class="ace-settings-box clearfix" id="ace-settings-box">
						<div class="pull-left width-50">
							<!-- #section:settings.skins -->
							<div class="ace-settings-item">
								<div class="pull-left">
									<select id="skin-colorpicker" class="hide">
										<option data-skin="no-skin" value="#438EB9">#438EB9</option>
										<option data-skin="skin-1" value="#222A2D">#222A2D</option>
										<option data-skin="skin-2" value="#C6487E">#C6487E</option>
										<option data-skin="skin-3" value="#D0D0D0">#D0D0D0</option>
									</select>
								</div>
								<span>&nbsp; Choose Skin</span>
							</div>

							<!-- /section:settings.skins -->

							<!-- #section:settings.navbar -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-navbar" /> <label class="lbl"
									for="ace-settings-navbar"> Fixed Navbar</label>
							</div>

							<!-- /section:settings.navbar -->

							<!-- #section:settings.sidebar -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-sidebar" /> <label class="lbl"
									for="ace-settings-sidebar"> Fixed Sidebar</label>
							</div>

							<!-- /section:settings.sidebar -->

							<!-- #section:settings.breadcrumbs -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-breadcrumbs" /> <label class="lbl"
									for="ace-settings-breadcrumbs"> Fixed Breadcrumbs</label>
							</div>

							<!-- /section:settings.breadcrumbs -->

							<!-- #section:settings.rtl -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-rtl" /> <label class="lbl"
									for="ace-settings-rtl"> Right To Left (rtl)</label>
							</div>

							<!-- /section:settings.rtl -->

							<!-- #section:settings.container -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-add-container" /> <label class="lbl"
									for="ace-settings-add-container"> Inside <b>.container</b>
								</label>
							</div>

							<!-- /section:settings.container -->
						</div>
						<!-- /.pull-left -->

						<div class="pull-left width-50">
							<!-- #section:basics/sidebar.options -->
							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-hover" /> <label class="lbl"
									for="ace-settings-hover"> Submenu on Hover</label>
							</div>

							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-compact" /> <label class="lbl"
									for="ace-settings-compact"> Compact Sidebar</label>
							</div>

							<div class="ace-settings-item">
								<input type="checkbox" class="ace ace-checkbox-2"
									id="ace-settings-highlight" /> <label class="lbl"
									for="ace-settings-highlight"> Alt. Active Item</label>
							</div>

							<!-- /section:basics/sidebar.options -->
						</div>
						<!-- /.pull-left -->
					</div>
					<!-- /.ace-settings-box -->
				</div>
				<!-- /.ace-settings-container -->

				<!-- /section:settings.box -->
				<div class="page-content-area">
					<!-- ajax content goes here -->
				</div>
				<!-- /.page-content-area -->
			</div>
			<!-- /.page-content -->
		</div>
		<!-- /.main-content -->

		<div class="footer">
			<div class="footer-inner">
				<!-- #section:basics/footer -->
				<div class="footer-content">
					<span class="bigger-120"> <span class="blue bolder">Zheng
							Nai</span> Application &copy; 2014-2015
					</span>  

				</div>

				<!-- /section:basics/footer -->
			</div>
		</div>

		<div id="modal-form" class="modal" tabindex="-1">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">&times;</button>
						<h4 class="blue bigger">请绑定您的帐号</h4>
					</div>
					<div class="modal-body">
						<div class="row">
							<div class="col-xs-12 col-sm-12">
								<div class="form-group">
									<label for="form-field-username">邮箱</label>
									<div>
										<input class="input-large" type="text" id="emailBind"
											placeholder="Email" value="" />
									</div>
								</div>

								<div class="space-4"></div>

								<div class="form-group">
									<label for="form-field-first">密码</label>

									<div>
										<input class="input-large" type="passowrd" id="passwordBind"
											placeholder="Password" value="" />
									</div>
								</div>
							</div>
						</div>
					</div>

					<div class="modal-footer">
						<button class="btn btn-sm" data-dismiss="modal">
							<i class="ace-icon fa fa-times"></i> 取消
						</button>

						<button class="btn btn-sm btn-primary" onclick="bindAccount()">
							<i class="ace-icon fa fa-check"></i> 提交
						</button>
					</div>
				</div>
			</div>
		</div>


		<a href="#" id="btn-scroll-up"
			class="btn-scroll-up btn btn-sm btn-inverse"> <i
			class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
		</a>
	</div>
	<!-- /.main-container -->

	<!-- basic scripts -->

	<!--[if !IE]> -->
	<script type="text/javascript">
		window.jQuery
				|| document
						.write("<script src='../../assets/js/jquery.min.js'>"
								+ "<"+"/script>");
	</script>

	<!-- <![endif]-->

	<!--[if IE]>
<script type="text/javascript">
 window.jQuery || document.write("<script src='../../assets/js/jquery1x.min.js'>"+"<"+"/script>");
</script>
<![endif]-->
	<script type="text/javascript">
		if ('ontouchstart' in document.documentElement)
			document
					.write("<script src='../../assets/js/jquery.mobile.custom.min.js'>"
							+ "<"+"/script>");
	</script>
	<script src="../../assets/js/bootstrap.min.js"></script>

	<!-- ace scripts -->
	<script src="../../assets/js/ace-elements.min.js"></script>
<!-- 	<script src="../../assets/js/ace.min.js"></script> -->
	<script src="../../assets/js/uncompressed/ace.js"></script>
	<script src="../../assets/js/bootbox.min.js"></script>
	<script src="common.js"></script>
	<script type="text/javascript">
		//Load content via ajax
		jQuery(function($) {
			if ('enable_ajax_content' in ace) {
				var options = {
					content_url : function(url) {
						//this is for Ace demo only, you should change it
						//please refer to documentation for more info

						if (!url.match(/^page\//))
							return false;

						var path = document.location.pathname;
						
						console.log("path:" + path);

						//for Ace HTML demo version, convert ajax.html#page/gallery to > gallery.html and load it
						if (path.match(/ajax\.html/)) {
							var path2 = path.replace(/ajax\.html/, url.replace(
									/^page\//, '')
									+ '.html');
							//path2 += "?aa=3&radmon=" + Math.random();
							console.log("path2:" + path2);
							return path2;
						}

						//for Ace PHP demo version convert "page/dashboard" to "?page=dashboard" and load it
						var path3 = path + "?" + url.replace(/\//, "=") 
						console.log("path3:" + path3);
						return path3;
					},
					default_url : 'page/quizs'//default url
				}
				ace.enable_ajax_content($, options)
			}

		})

		//alert("here1");
		$.ajax({
			type : "POST",
			url : "../../getUser",
			async : true,
			dataType : "json",
			success : function(data) {
				//alert("getUser data:" + data);
				var showName = "";
				if (data.nickname == null || data.nickname == "") {
					showName = data.email;
				} else {
					showName = data.nickname;
				}
				$("#usernameSpan").html(showName);
				$("#headImg").attr("src", data.headimgurl);

				var confirmResult = false;
				if (data.bindRemind != "N" && (data.email == null || data.email == "")) {
					bootbox.confirm(
							"你好，你有该网站的email帐号吗？",
							function(result) {
								if (result) {
									$("#modal-form").modal();
									$('#modal-form').on(
											'hide.bs.modal',
											function() {
												if (!confirmResult) {
													bootbox.confirm(
														"绑定后，您在邮箱帐号和微信帐号就同步了，确定不绑定吗？",
														function(result) {
															if (result) {
																confirmResult = true;
																$("#modal-form").modal(
																		'hide');
																updateUserReminder("N");
															} else {
																$("#modal-form").modal(
																		'show');
															}
														});
												}
											});
								} else {
									updateUserReminder("N");
								}  
							});
					
					
				}
			},
			error : function(data) {
				alert("set error, please contact administrator");
			}

		});

		//chosen plugin inside a modal will have a zero width because the select element is originally hidden
		//and its width cannot be determined.
		//so we set the width after modal is show
		$('#modal-form').on('shown.bs.modal', function() {
			$(this).find('.chosen-container').each(function() {
				$(this).find('a:first-child').css('width', '210px');
				$(this).find('.chosen-drop').css('width', '210px');
				$(this).find('.chosen-search input').css('width', '200px');
			});
		})

		function bindAccount() {
			var emailBind = $("#emailBind").val();
			var passwordBind = $("#passwordBind").val();
			if (emailBind == "" || passwordBind == "") {
				alert("邮箱和密码不能为空哦");
				return;
			}

			$.ajax({
				type : "POST",
				url : "../../bindAccount",
				data : {
					emailBind : emailBind,
					passwordBind : passwordBind
				},
				async : true,
				dataType : "text",
				success : function(data) {
					alert(data);
					if (data.indexOf("成功") >= 0) {
						window.location.reload();
					}
				},
				error : function(data) {
					alert("set error, please contact administrator");
				}

			});
		}

		function updateUserReminder(reminderVal) {
			$.ajax({
				type : "POST",
				url : "../../updateUserReminder",
				data : {
					reminderVal : reminderVal 
				},
				async : true,
				dataType : "text",
				success : function(data) {
				},
				error : function(data) {
				}

			});
		}
		
		
		//alert("here2");
	</script>
</body>
</html>
